package socket;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable{
    /** 
	* serialVersionUID : 
	*/ 
	private static final long serialVersionUID = 8098801969098437505L;


    private Long id;

    private String username;

    private String password;

    private String salt;

    private Boolean locked;
    
    private String mailAddr;
    private String mailAddrOut;
    
    private String phoneNumber;
    private Long unitId;//单位id
    private Long deptId;//部门id
    private String realName;

    //20210830新增用户类型
	private String userType; //1:系统用户 2:邮件用户(邮件用户默认锁定.)
	private String createBy;
	private Date createTime;
	private String updateBy;
	private Date updateTime;

	public static final String SYS_USER = "1";
	public static final String MAIL_USER = "2";

	public static boolean isAdmin(String username){
		return Objects.equals("admin", username);
	}
}